﻿using System.Collections;
using Assets.Scripts.Game.Common;
using Assets.Scripts.Game.Event;
using Assets.Scripts.Game.RenderObj;
using UnityEngine;

namespace Assets.Scripts.Game.GameObj
{
    public enum ObjType : int
    {
        Node = 1,
        World = 2,
        Unit = 3,
        Player = 4,
        Characater = 5,

    }


    public abstract class ObjectNode  {
        protected ObjectNode()
        {
            CurObjType = ObjType.Node;

        }

        protected ObjType ObjType;

        public ObjType CurObjType
        {
            get { return ObjType; }
            set { ObjType = value; }
        }


        public int CurId { get; set; }


        private Position _pos;

        private int _direction;




        //位置信息
        public int Direction
        {
            get { return _direction; }
            set { _direction = value; }
        }

        public Position Pos
        {
            get { return _pos; }
            set { _pos = value; }
        }




        /*
  获得渲染接口
  */
        public EntityNode GetRenderInterface()
        {
            return CurNode;
        }

        protected EntityNode CurNode;




        //----------------------------------------------------------------------------------------------------

        /*
     初始化接口
     */
        public virtual void Init()
        {

        }

        /**
     释放接口
     */
        public virtual void Destory()
        {

        }


        //----------------------------------------------------------------------------------------------------
        /**
     压入指令
     */
        public virtual bool PushCommand(BaseEvent command)
        {
            OnCommand(command);
            return true;
        }

        protected virtual Opcode OnCommand(BaseEvent command)
        {
            return Opcode.Ok;
        }


    }
}